<?php
namespace Cubemarketing;

use Cubemarketing\Model\StoreTable;
use Cubemarketing\Model\SaleHeadTable;
use Cubemarketing\Model\SaleRowTable;
use Cubemarketing\Model\ArticleTable;
use Cubemarketing\Model\FamilyTable;

class Module
{    
    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }
    
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }
    
    public function getServiceConfig()
    {
        return array(
            'factories' => array(
                
                // Service for Store table
                'Cubemarketing\Model\StoreTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new StoreTable($dbAdapter);
                    return $table;
                },
                        
                // Service for SaleHead table
                'Cubemarketing\Model\SaleHeadTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new SaleHeadTable($dbAdapter);
                    return $table;
                },
                        
                // Service for SaleRow table
                'Cubemarketing\Model\SaleRowTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new SaleRowTable($dbAdapter);
                    return $table;
                },
                        
                // Service for Article table
                'Cubemarketing\Model\ArticleTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new ArticleTable($dbAdapter);
                    return $table;
                },
                        
                // Service for Family table
                'Cubemarketing\Model\FamilyTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table = new FamilyTable($dbAdapter);
                    return $table;
                },
            ),
        );
    }
}
